/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ngramassigment;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import ngramassigment.calculate.CalculateProbabilityOfSentence;
import ngramassigment.data.ResultDataProbability;
import ngramassigment.database.DatabaseManager;
import ngramassigment.fileprocess.FileFunction;
import ngramassigment.fileprocess.ProcessSeparate;

/**
 *
 * @author Tran
 */
public class NGramAssigment {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        
        //uncomment to training
//        DatabaseManager.getInstance().createTableVocabulary();
//        DatabaseManager.getInstance().createTableBiGram();
//        DatabaseManager.getInstance().createTableTriGram();
//        DatabaseManager.getInstance().createTableTetGram();
//        DatabaseManager.getInstance().createTablePenGram();
//
//
//        int start = 1;
//        int end = 6;
//        
//        /*
//         * Tien hanh tinh chinh du lieu de tach duoc tung single phrase
//         */
//        for (int i = start; i <= end; i++) {
//            String fileNameIn = Config.PATH_DATA_PRE_PROCESS+i+".txt";
//            String fileNameOut = Config.PATH_ALL_SINGLE_PHRASE+i+".txt";
//            try {
//                ProcessSeparate.getInstance().processOneFileInit(fileNameIn, fileNameOut);
//            } catch (FileNotFoundException ex) {
//                Logger.getLogger(NGramAssigment.class.getName()).log(Level.SEVERE, null, ex);
//            } catch (IOException ex) {
//                Logger.getLogger(NGramAssigment.class.getName()).log(Level.SEVERE, null, ex);
//            }
//        }
//        
//        for (int current = start; current <= end; current++) {
//            try {
//                FileFunction.getInstance().processOneFileSeparate(Config.PATH_ALL_SINGLE_PHRASE + current + ".txt", current);
//            } catch (FileNotFoundException ex) {
//                Logger.getLogger(NGramAssigment.class.getName()).log(Level.SEVERE, null, ex);
//            } catch (IOException ex) {
//                Logger.getLogger(NGramAssigment.class.getName()).log(Level.SEVERE, null, ex);
//            }
//            System.out.println("finish: "+current);
//        }
//       
//        if (Config.IS_UPDATE_DICTIONARY)
//            FileFunction.getInstance().storeDataInHashMapToDatabase();
    

    
        
        //Check train data
//        String sen = "Đại hội thể dục thể thao.";
//        int typeGram = 3;  //2: BIGRAM,  3: TRIGRAM,  4: TETGRAM,   5:PENGRAM
//        List<ResultDataProbability> lsRe = CalculateProbabilityOfSentence.getInstance().calculateProbOfSentences(sen, typeGram);
//        int a = 0;
    }
}
